package com.springboot.cloud.demos.feign.service;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.form.OrderForm;
import com.springboot.cloud.demos.entity.param.OrderQueryParam;
import com.springboot.cloud.demos.entity.po.Order;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name = "ribbon-consumer", fallback = OrderServiceFallback.class)
public interface OrderService {

    @RequestMapping(value = "/order/conditions", method = RequestMethod.POST)
    Result conditions(OrderQueryParam params);

    @RequestMapping(value = "/order/{id}", method = RequestMethod.GET)
    Result<Order> order(@PathVariable(value = "id") String id);

    @RequestMapping(value = "/order", method = RequestMethod.POST)
    Result<Order> add(@RequestBody OrderForm orderForm);

    @RequestMapping(value = "/order", method = RequestMethod.PUT)
    Result update(@RequestBody OrderForm orderForm);

    @RequestMapping(value = "/order/{id}", method = RequestMethod.DELETE)
    void delete(@PathVariable(value = "id") String id);

}
